package com.learn.rabbit.base.config;

import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 队列配置
 *
 * @author zhousiqi
 * @version 1.0.0
 * @date 2019/2/26 17:59
 */
@Configuration
public class QueueConfig {

    public static final String FIRST_QUEUE = "first-queue";
    public static final String SECOND_QUEUE = "second-queue";

    /**
     * durable="true" 持久化 rabbitmq重启的时候不需要创建新的队列
     * auto-delete 表示消息队列没有在使用时将被自动删除 默认是false
     * exclusive  表示该消息队列是否只在当前connection生效,默认是false
     */
    @Bean
    public Queue firstQueue() {
        return new Queue(FIRST_QUEUE, true, false, false);
    }

    @Bean
    public Queue secondQueue() {
        return new Queue(SECOND_QUEUE, true, false, false);
    }
}
